#ifndef CPACKETCAP_H
#define CPACKETCAP_H

#include "pcaphost.h"
#include "pcaphandle.h"
#include "pcappacket.h"
#include "pcapsendqueue.h"

class CPacketCap : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QString version READ version)
public:
    explicit CPacketCap(QObject *parent = 0);
    ~CPacketCap();

    QString version() const;

    Q_INVOKABLE bool init();

    Q_INVOKABLE CPCapHost* newHost();
    Q_INVOKABLE void delHost(CPCapHost *host);

    Q_INVOKABLE CPCapHandle* newHandle();
    Q_INVOKABLE void delHandle(CPCapHandle *handle);

    Q_INVOKABLE CPCapPacket* newPacket();
    Q_INVOKABLE void delPacket(CPCapPacket *handle);

    Q_INVOKABLE CPCapSendQueue* newSendQueue();
    Q_INVOKABLE void delSendQueue(CPCapSendQueue *sendQueue);

Q_SIGNALS:
    void errorString(QString error);

private:
    void clear_host();
    void clear_handles();
    void clear_packets();
    void clear_send_queues();

    QString m_version;
    QList<CPCapHost*> m_hosts;
    QList<CPCapHandle*> m_handles;
    QList<CPCapPacket*> m_packets;
    QList<CPCapSendQueue*> m_sendQueues;
};

#endif // CPACKETCAP_H
